package com.tangkun.environment.activity;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.tangkun.environment.R;
import com.tangkun.environment.network.GlobalUrl;
import com.tangkun.environment.utils.JumpHelper;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 关于与帮助
 */
public class GuanYuActivity extends BaseActivity {

    @BindView(R.id.back)
    ImageView back;
    @BindView(R.id.title)
    TextView title;
    private Context mContext;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_guan_yu);
        mContext = this;
        ButterKnife.bind(this);
        title.setText("关于与帮助");
    }

    @OnClick({R.id.back, R.id.ll_guanyu_bangzhuzhichi, R.id.ll_guanyu_yijianfankui, R.id.ll_guanyu_yinsizhengce})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.back:
                JumpHelper.finish(mContext);
                break;
            case R.id.ll_guanyu_bangzhuzhichi://帮助支持
                String tel = "028-61383738";
                if (!TextUtils.isEmpty(tel)) {
                    Intent intent = new Intent(Intent.ACTION_DIAL);
                    Uri data = Uri.parse("tel:" + tel);
                    intent.setData(data);
                    startActivity(intent);
                } else {
                    showToast("电话号码为空");
                }
                break;
            case R.id.ll_guanyu_yijianfankui://意见反馈
                JumpHelper.jump(GuanYuActivity.this, YiJianFanKuiActivity.class, false);
                break;
            case R.id.ll_guanyu_yinsizhengce://隐私政策
                Intent yinsizhengcheIntent = new Intent(GuanYuActivity.this, WebActivity.class);
                yinsizhengcheIntent.putExtra("title", "隐私政策");
                yinsizhengcheIntent.putExtra("url", GlobalUrl.YINSIZHENGCE_URL);
                JumpHelper.jump(GuanYuActivity.this, yinsizhengcheIntent, false);
                break;
        }
    }
}
